{$CLEO .cm}

  $onmission = 2   //I won't flag it to 1 cause of game freeze for getting wasted or busted, I have know I idea have to fix it back then so 2 is alter instead 
{
  this is a template or example

}   
               
04ED: load_animation  "RIOT"
04ED: load_animation  "PLAYIDLES"
fade 0 500
wait 500
fade 1 500 
0395: clear_area 1 at 1433.5031 2623.1221 11.3926 radius 255.0


{
consts makes alot easier to name this vars like
5@ as ENEMY for example.



}
 const  
  asset_marker = 1@ 
  1_ASSET_WAYPOINT = 1000@ 
  1_ASSET_TARGET_MARKER = 1001@  
  1_KILL_CROWDED = 1002@  
2_CROWD1 = 500@    
2_CROWD2 = 501@    
2_CROWD3 = 502@    
2_CROWD4 = 503@    
2_CROWD5 = 504@    
2_CROWD6 = 505@    
2_CROWD7 = 506@    
2_CROWD8 = 507@    
2_CROWD9 = 508@    
2_CROWD10 = 509@    
2_CROWD11 = 510@    
2_CROWD12 = 511@    
2_CROWD13 = 512@    
2_CROWD14 = 513@    
2_CROWD15 = 514@    
2_CROWD16 = 515@    
2_CROWD17 = 516@    
2_CROWD18 = 517@    
2_CROWD19 = 518@    
2_CROWD20 = 519@    
2_CROWD21 = 520@
3_CROWD_TARGET1 = 550@
3_CROWD_TARGET2 = 551@
3_CROWD_TARGET3 = 552@
3_CROWD_TARGET4 = 553@


2_CLIENT = 540@ 
2_BODYGUARDS1 = 541@
2_BODYGUARDS2 = 542@
2_BODYGUARDS3 = 543@
2_BODYGUARDS4  = 544@
 2_TRAIN = 545@    
 2_CLIENT_HEALTH = 546@ 
  give_points = 75@
 end
 
model.Load(#BALLAS2) 
model.Load(#STREAK) 
model.Load(#STREAKc) 
model.Load(#BALLAS2) 
model.Load(#WFYCLOT) 
model.Load(#WMYGOL1) 
model.Load(#WMYGOL2) 
model.Load(#MALE01) 
model.Load(#BMYMIB) 
model.Load(#BMOCD) 
model.Load(#BMYTATT) 
model.Load(#BMYPOL2) 
model.Load(#BMYPOL1) 
model.Load(#SFR2) 
model.Load(#BMYPOL1) 
model.Load(#BMYPOL1) 
model.Load(#BIKDRUG) 
model.Load(#OMYRI) 
model.Load(#SWMORI) 
model.Load(#SFYPRO) 
model.Load(#WFYST) 
model.Load(#SFYPRO) 
model.Load(#SFYPRO) 
model.Load(#OMYRI) 
model.Load(#VLA1) 
model.Load(#MAFBOSS) 
model.Load(#BF400) 
model.Load(#SENTINEL) 
model.Load(#ADMIRAL) 
model.Load(#COLT45) 
model.Load(1946)
model.Load(3060) 
model.Load(#WMYSGRD) 
038B: load_requested_models
actor.PutAt($player_actor,  1435.7091, 2614.2964, 11.3926)
actor.Angle($player_actor)=  358.4708
1_KILL_CROWDED = false 
2_CROWD1=actor.Create(civmale, #WFYCLOT ,1437.4928, 2622.95, 11.3926 ) 
actor.Angle(2_CROWD1)= 94.1488 
2_CROWD2=actor.Create(civmale, #WMYGOL1 , 1436.8229, 2617.4011, 11.3926) 
actor.Angle(2_CROWD2)=  90.3951
2_CROWD3=actor.Create(civmale, #MALE01 , 1437.0221, 2620.5454, 11.3926) 
actor.Angle(2_CROWD3)=128.2869  
2_CROWD4=actor.Create(civmale, #WMYGOL2 , 1430.3623, 2623.6941, 11.3926) 
actor.Angle(2_CROWD4)=294.3535  
2_CROWD5=actor.Create(civmale, #BMOCD , 1430.7239, 2621.3655, 11.3926) 
actor.Angle(2_CROWD5)= 266.5172 
2_CROWD6=actor.Create(civmale, #MALE01 , 1430.2675, 2618.1997, 11.3926) 
actor.Angle(2_CROWD6)= 260.8211 
2_CROWD7=actor.Create(civmale, #BMYPOL2 , 1428.7578, 2615.5039, 11.3926) 
actor.Angle(2_CROWD7)= 278.3287 
2_CROWD8=actor.Create(civmale, #OMYRI ,1438.4492, 2615.3608, 11.3926 ) 
actor.Angle(2_CROWD8)=  104.0312
2_CROWD9=actor.Create(civmale, #WMYGOL1 ,1438.5662, 2614.063, 11.3926 ) 
actor.Angle(2_CROWD9)=  107.7749
2_CROWD10=actor.Create(civmale, #WFYCLOT ,1426.7788, 2626.645, 11.3926 ) 
actor.Angle(2_CROWD10)= 266.5977 
2_CROWD11=actor.Create(civmale, #BMYPOL2 ,1428.0496, 2628.4341, 11.3926 ) 
actor.Angle(2_CROWD11)= 280.7313 
2_CROWD12=actor.Create(civmale, #WFYCLOT ,1427.3779, 2624.0408, 11.3926 ) 
actor.Angle(2_CROWD12)= 283.0603 
2_CROWD13=actor.Create(civmale, #BMYTATT , 1440.4944, 2624.7114, 11.3926) 
actor.Angle(2_CROWD13)=87.3311  
2_CROWD14=actor.Create(civmale, #WFYST ,1442.8723, 2627.1602, 11.3926 ) 
actor.Angle(2_CROWD14)= 98.5152 
2_CROWD15=actor.Create(civmale, #SFYPRO , 1442.4611, 2629.2664, 11.3906) 
actor.Angle(2_CROWD15)=  110.1947
2_CROWD16=actor.Create(civmale, #BMYTATT ,1431.2227, 2619.29, 11.3926 ) 
actor.Angle(2_CROWD16 )=246.5858  
2_CROWD17=actor.Create(civmale, #WFYST ,1435.6376, 2618.9988, 11.3926 ) 
actor.Angle(2_CROWD17 )= 99.9331 
 2_CLIENT = actor.Create(civfemale,#MAFBOSS , 1434.7173, 2614.5659, 11.3926 ) 
 actor.Angle(2_CLIENT)=1.1982 
 actor.Health(2_CLIENT)=5000
 0446: set_actor 2_CLIENT dismemberment_possible 0
 
 
 
 {
   Make peds don't react from shooting.
   They will remained stationary 
 
 
 }
 060B: set_actor 2_CROWD1 decision_maker_to 32
 060B: set_actor 2_CROWD2 decision_maker_to 32
 060B: set_actor 2_CROWD3 decision_maker_to 32
 060B: set_actor 2_CROWD4 decision_maker_to 32
 060B: set_actor 2_CROWD5 decision_maker_to 32
 060B: set_actor 2_CROWD6  decision_maker_to 32
 060B: set_actor 2_CROWD7 decision_maker_to 32
 060B: set_actor 2_CROWD8 decision_maker_to 32
 060B: set_actor 2_CROWD9 decision_maker_to 32
 060B: set_actor 2_CROWD10 decision_maker_to 32
 060B: set_actor 2_CROWD11 decision_maker_to 32
 060B: set_actor 2_CROWD12 decision_maker_to 32
 060B: set_actor 2_CROWD13 decision_maker_to 32
 060B: set_actor 2_CROWD14 decision_maker_to 32
 060B: set_actor 2_CROWD15 decision_maker_to 32
 060B: set_actor 2_CROWD16 decision_maker_to 32
 060B: set_actor 2_CROWD17 decision_maker_to 32 

0615: define_AS_pack_begin 154@
05D3: AS_actor -1  goto_point 1433.459 2616.3647 11.3926  mode 4 time -1  ms // versionA
 0812: AS_actor -1 perform_animation "stretch" IFP "PLAYIDLES" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1  // versionB
05D3: AS_actor -1  goto_point 1433.5795 2626.6052 11.3926  mode 4 time -1  ms // versionA
 0812: AS_actor -1 perform_animation "time" IFP "PLAYIDLES" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1  // versionB 

0618: assign_actor 2_CLIENT to_AS_pack 154@
0643: set_AS_pack 154@ loop 1

061B: remove_references_to_AS_pack 154@
 
 {
    Bodyguards are some example for assistants 
 }
  2_BODYGUARDS1 = actor.Create(gang2,#WMYSGRD ,1441.3585, 2636.7827, 10.8203 ) 
 actor.Angle(2_BODYGUARDS1)= 144.7325
 actor.Health(2_BODYGUARDS1)=2000
 0446: set_actor 2_BODYGUARDS1 dismemberment_possible 0
 actor.GiveWeaponAndAmmo(2_BODYGUARDS1, pistol , 99999)
 081A: set_actor 2_BODYGUARDS1 weapon_skill_to  3
07DD: set_actor 2_BODYGUARDS1 attack_rate 65 // previously known as temper_to
0638: AS_actor 2_BODYGUARDS1 stay_put 1
actor.SetWalkStyle(2_BODYGUARDS1, "shuffle")

  2_BODYGUARDS2 = actor.Create(gang2,#WMYSGRD , 1435.1271, 2636.7051, 10.8203) 
 actor.Angle(2_BODYGUARDS2)=183.7321 
 actor.Health(2_BODYGUARDS2)=2000
 0446: set_actor 2_BODYGUARDS2 dismemberment_possible 0
 actor.GiveWeaponAndAmmo(2_BODYGUARDS2, pistol , 99999)
 081A: set_actor 2_BODYGUARDS2 weapon_skill_to  3
07DD: set_actor 2_BODYGUARDS2 attack_rate 65 // previously known as temper_to
0638: AS_actor 2_BODYGUARDS2 stay_put 1
actor.SetWalkStyle(2_BODYGUARDS2, "shuffle")
  2_BODYGUARDS3 = actor.Create(gang2,#WMYSGRD ,1443.4764, 2629.4312, 11.3906 ) 
 actor.Angle(2_BODYGUARDS3)= 118.2481
 actor.Health(2_BODYGUARDS3)=2000
 0446: set_actor 2_BODYGUARDS3 dismemberment_possible 0
 actor.GiveWeaponAndAmmo(2_BODYGUARDS3, pistol , 99999)
 081A: set_actor 2_BODYGUARDS3 weapon_skill_to  3
07DD: set_actor 2_BODYGUARDS3 attack_rate 65 // previously known as temper_to
0638: AS_actor 2_BODYGUARDS3 stay_put 1
actor.SetWalkStyle(2_BODYGUARDS3, "shuffle")
  2_BODYGUARDS4 = actor.Create(gang2,#WMYSGRD , 1417.4899, 2629.8726, 11.3906) 
 actor.Angle(2_BODYGUARDS4)= 263.3253
 actor.Health(2_BODYGUARDS4)=2000
 0446: set_actor 2_BODYGUARDS4 dismemberment_possible 0
 actor.GiveWeaponAndAmmo(2_BODYGUARDS4, pistol , 99999)
 081A: set_actor 2_BODYGUARDS4 weapon_skill_to  3
07DD: set_actor 2_BODYGUARDS4 attack_rate 65 // previously known as temper_to
0638: AS_actor 2_BODYGUARDS4 stay_put 1
actor.SetWalkStyle(2_BODYGUARDS4, "shuffle")

                  
077A: set_actor 2_CLIENT acquaintance 1 to_actors_pedtype 0 // see ped.dat
077A: set_actor 2_CLIENT acquaintance 1 to_actors_pedtype 1 // see ped.dat
077A: set_actor 2_CLIENT acquaintance 1 to_actors_pedtype 4 // see ped.dat
077A: set_actor 2_CLIENT acquaintance 1 to_actors_pedtype 5 // see ped.dat
060B: set_actor 2_CLIENT decision_maker_to 32 

{
 Make a crowd a cheer
}
0605: actor 2_CROWD1 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1
0605: actor 2_CROWD2 perform_animation "RIOT_CHANT" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD3 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD4 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD5 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD6 perform_animation "RIOT_CHANT" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD7 perform_animation "RIOT_CHANT" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD8 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD9 perform_animation "RIOT_CHANT" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD10 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD11 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD12 perform_animation "RIOT_CHANT" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD13 perform_animation "RIOT_CHANT" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD14 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD15 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD16 perform_animation "RIOT_shout" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0605: actor 2_CROWD17 perform_animation "RIOT_CHANT" IFP "RIOT" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
actor.Health(2_CROWD1)=500
actor.Health(2_CROWD2)=500
actor.Health(2_CROWD3)=500
actor.Health(2_CROWD4)=500
actor.Health(2_CROWD5)=500
actor.Health(2_CROWD6)=500
actor.Health(2_CROWD7 )=500
actor.Health(2_CROWD8)=500
actor.Health(2_CROWD9)=500
actor.Health(2_CROWD10)=500
actor.Health(2_CROWD11)=500
actor.Health(2_CROWD12)=500
actor.Health(2_CROWD13)=500
actor.Health(2_CROWD14)=500
actor.Health(2_CROWD15)=500
actor.Health(2_CROWD16)=500
actor.Health(2_CROWD17)=500
07FE: set_actor 2_CROWD1 fighting_style_to 4 moves 6
07FE: set_actor 2_CROWD2 fighting_style_to 4 moves 6
07FE: set_actor 2_CROWD3 fighting_style_to 15 moves 6
07FE: set_actor 2_CROWD4 fighting_style_to 4 moves 6
07FE: set_actor 2_CROWD5 fighting_style_to 15 moves 6
07FE: set_actor 2_CROWD6 fighting_style_to 5 moves 6
07FE: set_actor 2_CROWD7 fighting_style_to 5 moves 6
07FE: set_actor 2_CROWD8 fighting_style_to 5 moves 6
07FE: set_actor 2_CROWD9 fighting_style_to 7 moves 6
07FE: set_actor 2_CROWD10 fighting_style_to 6 moves 6
07FE: set_actor 2_CROWD11 fighting_style_to 7 moves 6
07FE: set_actor 2_CROWD12 fighting_style_to 15 moves 6
07FE: set_actor 2_CROWD13 fighting_style_to 4 moves 6
07FE: set_actor 2_CROWD14 fighting_style_to 6 moves 6
07FE: set_actor 2_CROWD15 fighting_style_to 4 moves 6
07FE: set_actor 2_CROWD16 fighting_style_to 7 moves 6
07FE: set_actor 2_CROWD17 fighting_style_to 5 moves 6

06D7: enable_train_traffic 0
06DB: destroy_all_trains
32@=0 
33@=0  


    03C3: set_timer_to $timer type 1 GXT 'BB_19' // global_variable  // Time
   014E: start_timer_at $timer  count_in_direction 0 // global_variable
     $timer = 260000     
          give_points = 0  
                   
                   {
                     This script is really simple, for mini game
                     While true goto to end of course!
                     
                     
                   }
      while true 
      wait 0
      FAIL()        //aka its gosub : it check for failure 
      2_CLIENT_HEALTH = actor.Health(2_CLIENT)
      gosub @CROWD_CONTROL 
      
       {
        Make a hazard, let's say, a train speed soooo fast
        Aparent normally this game don't have human shield but possible to 
        get or maybe make one.
        
        Human shield script not included
      
      }     
      if  and  
      33@ > 15000
      856E: not   car 2_TRAIN defined

      then
      33@ = 0 
        06D8: 2_TRAIN = create_train_at 1172.2061 2644.6069 13.3926  type 5 direction 1
        06DD: set_train 2_TRAIN speed 150.0
         06DC: set_train 2_TRAIN acc 150.0
     
      end 
      

      if  and 
      33@ > 2000
      056E:  car 2_TRAIN defined   
      then
      
         07BE: remove_references_to_train 2_TRAIN      
      end 
          //  1_KILL_CROWDED
        if   and
        075C:     marker 1_ASSET_TARGET_MARKER enabled     //make sure the marker doesn't re-enable another ped 
        056D:   actor 3_CROWD_TARGET1 defined
        then
              if   actor.Dead(3_CROWD_TARGET1)
              then
                   give_points += 1 
                    if 075C:    marker 1_ASSET_TARGET_MARKER enabled
                    then
                       marker.Disable(1_ASSET_TARGET_MARKER)
                    end                   
              end        
        end  
       if   and
       875C:  not  marker 1_ASSET_TARGET_MARKER enabled     //make sure the marker doesn't re-enable another ped 
        056D:   actor 3_CROWD_TARGET1 defined
       then
       
       //bodyguards will kill this ped who going after the client 
       0770: set_actor 3_CROWD_TARGET1 target_priority 1

       05E2: AS_actor 3_CROWD_TARGET1 kill_actor 2_CLIENT
       05E2: AS_actor 2_BODYGUARDS3 kill_actor 3_CROWD_TARGET1
       05E2: AS_actor 2_BODYGUARDS2 kill_actor 3_CROWD_TARGET1
       05E2: AS_actor 2_BODYGUARDS1  kill_actor 3_CROWD_TARGET1
       05E2: AS_actor 2_BODYGUARDS4 kill_actor 3_CROWD_TARGET1
                                         
            if not actor.Dead(3_CROWD_TARGET1)  //don't pick up dead ones
            then
                 if 875C:  not marker 1_ASSET_TARGET_MARKER enabled
                 then
                    marker.CreateAboveActor(1_ASSET_TARGET_MARKER,3_CROWD_TARGET1)    //The target ped only give you a score
                    
                 end
                 
            end
       else 
             
       end 
       
       //draw text on screen
       0ADF: add_dynamic_GXT_entry "_mini" text "~w~Crazy Crowds Killed: ~1~"
       0ADF: add_dynamic_GXT_entry "_def" text "~r~Client's Health: ~w~~1~"

        03F0: enable_text_draw 1 
        033F: set_text_draw_letter_size 0.5 1.0
        0340: set_text_draw_RGBA 255 255 255 255 
        0343: set_text_draw_linewidth 1000.0 
        0349: set_text_draw_font 1 
        081C: draw_text_outline 1 RGBA 0 0 0 255 
     045A: set_draw_text_position 37.0 80.0 GXT '_mini'  give_points   
           
        03F0: enable_text_draw 1 
        033F: set_text_draw_letter_size 0.5 1.0
        0340: set_text_draw_RGBA 255 255 255 255 
        0343: set_text_draw_linewidth 1000.0 
        0349: set_text_draw_font 1 
        081C: draw_text_outline 1 RGBA 0 0 0 255 
     045A: set_draw_text_position 37.0 95.0 GXT '_def'  2_CLIENT_HEALTH  
        if 
        give_points >= 10      //that's is the goal but keep in mind this is a test.
        then
            jump @end
        end 
     end 
jump @END 

:FAIL
if or 
actor.Dead(2_CLIENT )
0ADC:   test_cheat "exit"
0ADC:   test_cheat "abort"
wasted_or_busted 
then
 0ACD: show_text_highpriority "~r~Client is killed!" time 4000

jump @END 
end 
if 80FE:  not actor $PLAYER_ACTOR sphere 0 in_sphere  1429.4128 2620.8276 18.3566 radius 100.0 100.0 100.0
then
 0ACD: show_text_highpriority "~r~You abanadon the area!" time 4000

jump @END 
end

    if
    $timer == 0 
    then 
     0ACB: show_styled_text "~W~Time's up!" time  4000 style 6
      jump @END 
    end
return

 
:CROWD_CONTROL 
{    //Unused for now 
if
803B: not    3_CROWD_TARGET1 == 2_CROWD1  // (int)
then

end   }
0209: 175@ = random_int_in_ranges 0 16
if 32@ > 6000
then
        if 175@ == 0 
        then
        0085: 3_CROWD_TARGET1 = 2_CROWD1  // (int) 
        end
        if 175@ == 1 
        then
        0085: 3_CROWD_TARGET1 = 2_CROWD2 // (int)
        end
        if 175@ == 2 
        then
        0085:  3_CROWD_TARGET1 = 2_CROWD3// (int)
        end
        if 175@ == 3 
        then
        0085:  3_CROWD_TARGET1 = 2_CROWD4  // (int)
        end
        if 175@ == 4 
        then
        0085: 3_CROWD_TARGET1 = 2_CROWD5 // (int)
        end
        if 175@ == 5 
        then
            0085: 3_CROWD_TARGET1 = 2_CROWD6 // (int)
        end
        if 175@ == 6 
        then
           0085: 3_CROWD_TARGET1 = 2_CROWD7 // (int)
        end
        if 175@ == 7 
        then
           0085: 3_CROWD_TARGET1 = 2_CROWD8 // (int)
        end
        if 175@ == 8 
        then
            0085: 3_CROWD_TARGET1 = 2_CROWD9 // (int)
        end
        if 175@ == 9 
        then
            0085: 3_CROWD_TARGET1 = 2_CROWD10 // (int)
        end
        if 175@ == 10 
        then
            0085: 3_CROWD_TARGET1 = 2_CROWD11 // (int)
        end
        if 175@ == 11 
        then
              0085: 3_CROWD_TARGET1 = 2_CROWD12 // (int)
        end
        if 175@ == 12
        then
                0085: 3_CROWD_TARGET1 = 2_CROWD13 // (int)
        end
        if 175@ == 13 
        then
                 0085: 3_CROWD_TARGET1 = 2_CROWD14 // (int)
        end
        if 175@ == 14 
        then
                   0085: 3_CROWD_TARGET1 = 2_CROWD15 // (int)
        end
        if 175@ == 15 
        then
                  0085: 3_CROWD_TARGET1 = 2_CROWD16 // (int)
        end
        if 175@ == 16 
        then
                   0085: 3_CROWD_TARGET1 = 2_CROWD17 // (int)
        end 
32@ =0 

end
 
return  

:end  
 $onmission = 0  
 014F: stop_timer $timer
  
04EF: release_animation "RIOT"
04EF: release_animation "PLAYIDLES"
         
mission_cleanup
end_thread
